<template>
	<view class="page-wrap" :data-theme="theme" :class="theme" :style="globalColor.style">
		<HeadCustom title="引用人员名单"></HeadCustom>
		<view class="list">
			<view  v-for="(item, index) in listData" :key="index">
				<view class="fboxRow item">
					<image class="avatar" :src="item.imagePhoto" mode="aspectFill"></image>
					<view class="fboxCol flex1">
						<view class="name fboxRow Ycenter font32 lh44">{{item.realName}} <image class="icon-auth" src="https://ebc-prod.cdn.benwunet.com/uni-static/img3.3.0/icon-auth.png"></image></view>
						<view class="info mt10 font28 lh40 color-contentFontFourColor">{{item.positionName}} {{item.companyName}}</view>
					</view>
				</view>
				<view class="line"></view>
			</view>
			<u-loadmore fontSize="24rpx" :status="listConfig.loading" />
		</view>
	</view>
</template>

<script>
	import {hotQuoteUser} from '@/api/h5.js';
	export default {
		data() {
			return {
				theme: getApp().globalData.appTheme,
				globalColor: getApp().globalData.globalColor,
				listData: [],
				listConfig: {
					current: 1,
					size: 20,
					count: 0,
					loading: 'loadmore'
				},
				isApp: true,
				pageType: 0
			}
		},
		onLoad(option) {
			if (option.id) {
				this.id = option.id
				this.getInit()
				this.getList()
			}
			if(option.pageType){
				this.pageType = option.pageType
			}
		},
		methods: {
			getInit(){
				this.listConfig = {
					current: 1,
					size: 20,
					count: 0,
					loading: 'loadmore'
				}
				this.listData = []
			},
			getList(){
				hotQuoteUser({
					id: this.id,
					type: this.pageType,
					current: this.listConfig.current,
					size: this.listConfig.size
				}).then(res=>{
					if (this.listData.length) {
						this.listData = this.listData.concat(res.data.list)
					} else {
						this.listData = res.data.list
					}
					this.listLoading(res)
				})
			},
			listLoading(res) {
				if (res.data.total == 0) {
					this.listConfig.loading = 'list-not'
				} else if (res.data.total < res.data.size || res.data.current * res.data.size >= res.data.total) {
					this.listConfig.loading = 'nomore'
				}
				this.listConfig.count = res.data.total
			},
			listMore() {
				const {
					current,
					size,
					count,
					loading
				} = this.listConfig
				if (loading == 'nomore') {
					return
				}
				if (current * size < count) {
					this.listConfig.current = current + 1
					this.getList()
				} else {
					this.listConfig.loading = 'nomore'
				}
			},
			
		},
		onReachBottom() {
			this.listMore()
		},
		onPullDownRefresh() {
			this.getInit()
			this.getList()
			uni.stopPullDownRefresh(); //停止刷新
		},
	}
</script>

<style lang="scss" scoped>
	.avatar{margin-right: 22rpx; width: 100rpx;height: 100rpx;border-radius: 12rpx;}
	.icon-auth{margin-left: 4rpx; width: 40rpx;height: 40rpx}
	.list{padding:0 40rpx 40rpx;}
	.item{padding: 40rpx 0;}
	.line{width: 670rpx;height: 1rpx;background: #1E222F;}
</style>